package com.example.keshe0337.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.keshe0337.entity.ParkingRecord;
import com.example.keshe0337.entity.ParkingSpace;
import com.example.keshe0337.entity.User;

import java.util.List;

@Dao
public interface ParkingSpaceDao {
    @Insert
    long insertPS(ParkingSpace parkingSpace);

    @Delete
    void deletePS(ParkingSpace parkingSpace);

    @Update
    void updatePS(ParkingSpace parkingSpace);

    @Query("SELECT * FROM parking_space WHERE id = :sId")
    ParkingSpace getPSById(Long sId);

    @Query("SELECT * FROM parking_space WHERE space_num = :num")
    ParkingSpace getPSByNum(String num);

    @Query("SELECT * FROM parking_space WHERE space_num LIKE '%' || :num || '%'")
    List<ParkingSpace> getPSByNumList(String num);

    @Query("SELECT * FROM parking_space WHERE type LIKE '%' || :type || '%'")
    List<ParkingSpace> getPSByTypeLike(String type);

    @Query("SELECT * FROM parking_space")
    List<ParkingSpace> getAllPSs();
}
